<?php

namespace Modules\Shop\Http\Controllers;

use HiCommon\Service\ShopService;
use Illuminate\Support\Facades\Request;

class FinanceController extends BaseController
{
    /*财务统计*/
    public function finance_index(){
        try {
            $arr_search = Request::input();
            $n_shop_id = intval(shop_shop_id());
            $arr_search['shop_id'] = $n_shop_id;
            $arr_option = ['display'=>'only'];
            $result = ShopService::api_shop_finance_index($arr_search,$arr_option);
            $result['arr_search'] = $arr_search;
            if($result['state'] != 0){
                msg_error($result['msg']);
                return $result['msg'];
            }
            else{
                return view('shop::finance.finance_index',$result);
            }
        }
        catch (\Exception $exception) {
            msg_error($exception->getMessage());
            return '失败';
        }

    }

//    /*收益明细*/
//    public function profit_index(){
//
//        try {
//            $arr_search = Request::input();
//            $n_shop_id = intval(shop_shop_id());
//            $result = ShopService::api_shop_profit_index($n_shop_id,$arr_search);
//            $result['arr_search'] = $arr_search;
//            if($result['state'] != 0){
//                msg_error($result['msg']);
//                return $result['msg'];
//            }
//            else{
//                $n_shop_cate = $result['shop_cate'];
//                switch ($n_shop_cate)
//                {
//                    case 1:
//                        return view('shop::finance.profit_index_jc',$result);
//                        break;
//                    case 2:
//                        return view('shop::finance.profit_index_wx',$result);
//                        break;
//                    default:
//                        msg_error($result['msg'].'-'.$n_shop_cate);
//                        return $result['msg'];
//                }
//
//            }
//        }
//        catch (\Exception $exception) {
//            msg_error($exception->getMessage());
//            return '失败';
//        }
//
//    }
}
